package com.example.yucheng.service.impl;

import com.example.yucheng.domain.*;
import com.example.yucheng.mapper.OutboundMapper;
import com.example.yucheng.service.OutboundService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.Date;
import java.util.List;

@Service
public class OutboundServiceImpl implements OutboundService {

    @Autowired
    OutboundMapper outboundMapper;
    @Override
    public OutboundOrder getOutboundOrderList(String orderNo) {
        return outboundMapper.getOutboundOrderList(orderNo);
    }

    @Override
    public List<OutboundUnit> getOutboundOrderDetail(Integer oId) {
        return outboundMapper.getOutboundOrderDetail(oId);
    }

    @Override
    public void updateOutboundOrder(OutboundOrder outboundOrder) {
        outboundMapper.updateOutboundOrder(outboundOrder);
    }

    @Override
    public void deleteOutboundOrder(String orderNo) {
        outboundMapper.deleteOutboundOrder(orderNo);
    }

    @Override
    public void addOutboundOrder(OutboundOrder outboundOrder) {
        outboundMapper.addOutboundOrder(outboundOrder);
    }

    @Override
    public void addOutboundGood(OutboundGood outboundGood) {
        outboundMapper.addOutboundGood(outboundGood);
    }

    @Override
    public List<OutboundOrder> setSort( String receivingUnit, String goodName, Date startTime, Date endTime) {
       return outboundMapper.setSort(receivingUnit,goodName,startTime,endTime);
    }

    @Override
    public List<OutboundOrder> getAllOutboundOrderList(Integer pageNum, Integer pageSize) {
        return outboundMapper.getAllOutboundOrderList(pageNum,pageSize);
    }

    @Override
    public List<Loss> getLossList() {
        return outboundMapper.getLossList();
    }

    @Override
    public String findGoodName(String text) {
        return outboundMapper.findGoodName(text);
    }

    @Override
    public Stock findGoodNameById(int gId) {
        return outboundMapper.findGoodNameById(gId);
    }

    @Override
    public void addLoss(Loss loss) {
        outboundMapper.addLoss(loss);
    }

    @Override
    public void deleteLossById(int id) {
        outboundMapper.deleteLossById(id);
    }

    @Override
    public OutboundOrder findOutboundOrderByOrderNo(String orderNo) {
        return  outboundMapper.findOutboundOrderByOrderNo(orderNo);
    }

    @Override
    public List<OutboundOrder> getOutboundOrdeNo(@Param("receivingUnit")String receivingUnit,@Param("goodName") String goodName,@Param("startTime") Date startTime, @Param("endTime")Date endTime) {
        return outboundMapper.getOutboundOrdeNo(receivingUnit,goodName,startTime,endTime);
    }

    @Override
    public Loss getLossById(int id) {
        return outboundMapper.getLossById(id);
    }

    @Override
    public void addGoodList(@Param("id") Integer id,@Param("remark") String remark) {
         outboundMapper.addGoodList(id,remark);
    }

    @Override
    public void addOutboundUnit(@Param("rId") Integer rId, @Param("receivingPerson")String receivingPerson, @Param("department")String department, @Param("good")Stock good,@Param("oId")Integer oId, @Param("number") double number,@Param("remark") String remark,@Param("per") String per,@Param("costPrice") double costPrice) {
         outboundMapper.addOutboundUnit(rId,receivingPerson,department,good,oId,number,remark,per,costPrice);
    }

    @Override
    public int getOutGoodIdByGid(Integer id) {
        return outboundMapper.getOutGoodIdByGid(id);
    }

    @Override
    public List<OutboundGood> getOutboundGoodList(@Param("gId") Integer gId) {
        return outboundMapper.getOutboundGoodList(gId);
    }

    @Override
    public List<OutboundGood> getAllOutboundGoodList() {
        return outboundMapper.getAllOutboundGoodList();
    }

    @Override
    public List<OutboundUnit> getboundUnit(Integer id) {
        return outboundMapper.getboundUnit(id);
    }

    @Override
    public List<OutboundGood> getGoodInfo(Integer oId) {
        return outboundMapper.getGoodInfo(oId);
    }

    @Override
    public void updateOutboundDetail(OutboundUnit outboundUnit) {
        outboundMapper.updateOutboundDetail(outboundUnit);
    }

    @Override
    public OutboundGood  findOutboundGood(int id) {
        return outboundMapper.findOutboundGood();
    }

    @Override
    public void updateOutboundGoodInfo(Integer id, Integer gId) {
        outboundMapper.updateOutboundGoodInfo(id,gId);
    }

    @Override
    public void deleteOutboundUnit(int id) {
        outboundMapper.deleteOutboundUnit(id);
    }

    @Override
    public OutboundGood getOutboundByGid(Integer id) {
        return outboundMapper.getOutboundByGid(id);
    }
}
